//
// Created by 叶璨铭 on 2022/5/17.
//
#pragma once
#include <cstddef>
#include <cstdint>
#include <cstdarg>
#include "../p99/p99/p99.h"
#define VA_COUNT(...) detail::va_count(__VA_ARGS__)

namespace detail
{
    template<typename ...Args>
    constexpr std::size_t va_count(Args&&...) { return sizeof...(Args); }
}

//https://blog.csdn.net/10km/article/details/80773614

//// 参数拼接
//#define FL_CONCAT_(l, r) l ## r
//
//#define FL_CONCAT(l, r) FL_CONCAT_(l, r)
//
//#define FL_DOARG0(s,f,a,o)
//#define FL_DOARG1(s,f,a,v,...) f(a,v)
//#define FL_DOARG2(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG1(s,f,a,__VA_ARGS__)
//#define FL_DOARG3(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG2(s,f,a,__VA_ARGS__)
//#define FL_DOARG4(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG3(s,f,a,__VA_ARGS__)
//#define FL_DOARG5(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG4(s,f,a,__VA_ARGS__)
//#define FL_DOARG6(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG5(s,f,a,__VA_ARGS__)
//#define FL_DOARG7(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG6(s,f,a,__VA_ARGS__)
//#define FL_DOARG8(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG7(s,f,a,__VA_ARGS__)
//#define FL_DOARG9(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG8(s,f,a,__VA_ARGS__)
//#define FL_DOARG10(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG9(s,f,a,__VA_ARGS__)
//#define FL_DOARG11(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG10(s,f,a,__VA_ARGS__)
//#define FL_DOARG12(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG11(s,f,a,__VA_ARGS__)
//#define FL_DOARG13(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG12(s,f,a,__VA_ARGS__)
//#define FL_DOARG14(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG13(s,f,a,__VA_ARGS__)
//#define FL_DOARG15(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG14(s,f,a,__VA_ARGS__)
//#define FL_DOARG16(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG15(s,f,a,__VA_ARGS__)
//#define FL_DOARG17(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG16(s,f,a,__VA_ARGS__)
//#define FL_DOARG18(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG17(s,f,a,__VA_ARGS__)
//#define FL_DOARG19(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG18(s,f,a,__VA_ARGS__)
//#define FL_DOARG20(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG19(s,f,a,__VA_ARGS__)
//#define FL_DOARG21(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG20(s,f,a,__VA_ARGS__)
//#define FL_DOARG22(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG21(s,f,a,__VA_ARGS__)
//#define FL_DOARG23(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG22(s,f,a,__VA_ARGS__)
//#define FL_DOARG24(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG23(s,f,a,__VA_ARGS__)
//#define FL_DOARG25(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG24(s,f,a,__VA_ARGS__)
//#define FL_DOARG26(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG25(s,f,a,__VA_ARGS__)
//#define FL_DOARG27(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG26(s,f,a,__VA_ARGS__)
//#define FL_DOARG28(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG27(s,f,a,__VA_ARGS__)
//#define FL_DOARG29(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG28(s,f,a,__VA_ARGS__)
//#define FL_DOARG30(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG29(s,f,a,__VA_ARGS__)
//#define FL_DOARG31(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG30(s,f,a,__VA_ARGS__)
//#define FL_DOARG32(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG31(s,f,a,__VA_ARGS__)
//#define FL_DOARG33(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG32(s,f,a,__VA_ARGS__)
//#define FL_DOARG34(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG33(s,f,a,__VA_ARGS__)
//#define FL_DOARG35(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG34(s,f,a,__VA_ARGS__)
//#define FL_DOARG36(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG35(s,f,a,__VA_ARGS__)
//#define FL_DOARG37(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG36(s,f,a,__VA_ARGS__)
//#define FL_DOARG38(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG37(s,f,a,__VA_ARGS__)
//#define FL_DOARG39(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG38(s,f,a,__VA_ARGS__)
//#define FL_DOARG40(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG39(s,f,a,__VA_ARGS__)
//#define FL_DOARG41(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG40(s,f,a,__VA_ARGS__)
//#define FL_DOARG42(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG41(s,f,a,__VA_ARGS__)
//#define FL_DOARG43(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG42(s,f,a,__VA_ARGS__)
//#define FL_DOARG44(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG43(s,f,a,__VA_ARGS__)
//#define FL_DOARG45(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG44(s,f,a,__VA_ARGS__)
//#define FL_DOARG46(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG45(s,f,a,__VA_ARGS__)
//#define FL_DOARG47(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG46(s,f,a,__VA_ARGS__)
//#define FL_DOARG48(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG47(s,f,a,__VA_ARGS__)
//#define FL_DOARG49(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG48(s,f,a,__VA_ARGS__)
//#define FL_DOARG50(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG49(s,f,a,__VA_ARGS__)
//#define FL_DOARG51(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG50(s,f,a,__VA_ARGS__)
//#define FL_DOARG52(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG51(s,f,a,__VA_ARGS__)
//#define FL_DOARG53(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG52(s,f,a,__VA_ARGS__)
//#define FL_DOARG54(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG53(s,f,a,__VA_ARGS__)
//#define FL_DOARG55(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG54(s,f,a,__VA_ARGS__)
//#define FL_DOARG56(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG55(s,f,a,__VA_ARGS__)
//#define FL_DOARG57(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG56(s,f,a,__VA_ARGS__)
//#define FL_DOARG58(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG57(s,f,a,__VA_ARGS__)
//#define FL_DOARG59(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG58(s,f,a,__VA_ARGS__)
//#define FL_DOARG60(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG59(s,f,a,__VA_ARGS__)
//#define FL_DOARG61(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG60(s,f,a,__VA_ARGS__)
//#define FL_DOARG62(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG61(s,f,a,__VA_ARGS__)
//#define FL_DOARG63(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG62(s,f,a,__VA_ARGS__)
//#define FL_DOARG64(s,f,a,v,...) FL_DOARG1(s,f,a,v) s FL_DOARG63(s,f,a,__VA_ARGS__)
//
//#define FL_FOREACH_(sepatator,fun,funarg,...) \
//		FL_CONCAT(FL_DOARG,FL_ARG_COUNT(__VA_ARGS__))(sepatator,fun,funarg,__VA_ARGS__)
//#define FL_FOREACH(sepatator,fun,funarg,...) \
//		FL_FOREACH_(sepatator,fun,funarg,__VA_ARGS__)
//// 为动态参数 __VA_ARGS__ 每一个参数调用 fun 宏,最大支持64个参数
//// sepatator 分隔符
//// fun 函数宏
//// funarg 函数宏的参数
//
//
//////示例
//#define enum_elem(p,n) p##n,
////
////// 定义一个名为clsName的枚举类型,动态参数提供枚举类型的元素，最多支持64个元素
////// clsName##_为元素名前缀
////
////#define FL_DEF_ENUM(clsName,...)\
////enum _##clsName{\
////FL_FOREACH(,enum_elem,clsName##_,__VA_ARGS__) \
////    \
////	clsName##_LAST_ID \
////}clsName;
/////* must be last position,for competing enum's number  */
////// 定义4个元素
////FL_DEF_ENUM(FL_TEST0, 0)